<?php
/*
 * @Description: 
 * @Author: Leequik
 * @Date: 2025-07-27 23:09:43
 * @LastEditTime: 2025-07-28 00:40:35
 * @LastEditors: Leequik
 */

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Events\TestEvent;
use App\Services\SendMessageService;
use Illuminate\Support\Facades\Log;

class SendMsgJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $type;

    /**
     * Create a new job instance.
     */
    public function __construct($type)
    {
        $this->type = $type;
    }


    /**
     * Execute the job.
     */
    public function handle(): void
    {
        
        // $res = match($this->type){
        //     'a' => $this->test(),
        //     'b' => event(new TestEvent('1001',1,'Its my precious!')),
        //     'c' => (new SendMessageService)->timeoutToMinuteWarning(),
        //     default => 'default value',
        // };
        if($this->type == 'c'){
            (new SendMessageService)->timeoutToMinuteWarning();

        }
    }

    public function test(){
        Log::info('道爷我成了！');
        echo '道爷我成了！';
    }

}
